﻿using System;
using System.Windows.Forms;

namespace TISS_Add_in
{
    public partial class uc_DenteRegiao : UserControl
    {
        private string xPath;
        private string campoEscolhido = "dente";
        private Microsoft.Office.Interop.Word.ContentControl cc = null;

        public delegate void denteRegiaoSelectedHandler(string identificacao, string xPath, Microsoft.Office.Interop.Word.ContentControl cc);
        public event denteRegiaoSelectedHandler denteRegiaoChanged;

        public uc_DenteRegiao(string xPath, Microsoft.Office.Interop.Word.ContentControl contentControl)
        {
            InitializeComponent();

            this.xPath = xPath;
            this.cc = contentControl;

            rbDente.CheckedChanged += new EventHandler(rbDente_CheckedChanged);
            rbRegiao.CheckedChanged += new EventHandler(rbRegiao_CheckedChanged);
        }

        private void rbDente_CheckedChanged(object sender, EventArgs e)
        {
            if (rbDente.Checked)
                campoEscolhido = "dente";
        }

        private void rbRegiao_CheckedChanged(object sender, EventArgs e)
        {
            if (rbRegiao.Checked)
                campoEscolhido = "regiao";
        }

        private void btOK_Click(object sender, EventArgs e)
        {
            denteRegiaoChanged(campoEscolhido, xPath, this.cc);
            Globals.ThisAddIn.CustomTaskPanes.Remove(Globals.ThisAddIn.DenteRegiaoCTP);
        }
    }
}
